﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Admin/MasterPage_List.master" AutoEventWireup="true" CodeFile="NodeList.aspx.cs" Inherits="Main_NodeList" %>

<asp:Content ID="Content1" ContentPlaceHolderID="Head" runat="Server">
    <style>
        .div-content {
            height: 23px;
            overflow: hidden;
        }
    </style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="Title" runat="Server">
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="Search" runat="Server">
    <input class="easyui-searchbox" data-options="prompt:'模糊查询',searcher:doSearch" style="width: 300px" />
    <a id="btn_DeleteAll" href="javascript:void(0)" class="easyui-linkbutton" data-options="iconCls:'icon-clear'"
        onclick="deleteAll()" style="margin-left: 20px;">全部清空</a>
</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="Content" runat="Server">
    <div class="ht-panel-grid">
        <table id="grid" class="ht-grid" border="0" style="margin-top: 10px;">
            <thead>
                <tr>
                    <th class="th-order" data-field="CreateTime" style="width: 80px;">创建日期</th>
                    <th class="th-order" data-field="Content">内容</th>
                    <th style="width: 80px;">操作</th>
                </tr>
            </thead>
            <tbody>
            </tbody>
        </table>
    </div>
</asp:Content>
<asp:Content ID="Content5" ContentPlaceHolderID="Pager" runat="Server">
    <div id="pager"></div>
</asp:Content>
<asp:Content ID="Content6" ContentPlaceHolderID="Footer" runat="Server">

    <!--数据加载-->
    <script type="text/javascript">
        var sQueryString = "";

        $(function () {
            //加载数据
            refreshGrid();
        });

        function doSearch(value) {
            sQueryString = value;
            refreshGrid();
        }

        function refreshGrid() {
            $('#grid').BangleGrid({
                pager: '#pager',
                url: 'NodeList.aspx/GetGridDataHtml',
                query: {
                    QueryString: sQueryString,
                    pageSize: 10
                },
                afterSuccess: function () {
                    $('#grid .div-content').each(function () {
                        $(this).attr('title', $(this).text());
                    });
                }
            });
        }

        function reduction(id) {

            if (!confirm('确定要还原该数据吗？'))
                return;

            var param = new Object();
            param.Id = id;

            $.ajax({
                type: "post",
                datatype: "json",
                url: "NodeList.aspx/Reduction",
                contentType: "application/json",
                data: JSON.stringify(param),
                success: function (result) {
                    if (result.d != '') {
                        alert(result.d);
                    } else {
                        refreshGrid();
                        parent.refreshNodeData();
                    }
                }
            });
        }

        function permanentDelete(id) {

            if (!confirm('确定要永久删除该数据吗？'))
                return;

            var param = new Object();
            param.Id = id;

            $.ajax({
                type: "post",
                datatype: "json",
                url: "NodeList.aspx/PermanentDelete",
                contentType: "application/json",
                data: JSON.stringify(param),
                success: function (result) {
                    if (result.d != '') {
                        alert(result.d);
                    } else {
                        refreshGrid();
                        parent.refreshNodeData();
                    }
                }
            });
        }

        function deleteAll() {

            if (!confirm('确定要回收站的数据吗？'))
                return;

            var param = new Object();

            $.ajax({
                type: "post",
                datatype: "json",
                url: "NodeList.aspx/deleteAll",
                contentType: "application/json",
                data: JSON.stringify(param),
                success: function (result) {
                    if (result.d != '') {
                        alert(result.d);
                    } else {
                        refreshGrid();
                        parent.refreshNodeData();
                    }
                }
            });
        }
    </script>
</asp:Content>

